package model;

import java.time.LocalDateTime;

public class User {
    private String username;
    private String password;
    private String role;  // admin, manager, staff
    private String realName;
    private String phone;
    private String email;
    private LocalDateTime createTime;
    private boolean active;

    public User(String username, String password, String role, String realName) {
        this.username = username;
        this.password = password;
        this.role = role;
        this.realName = realName;
        this.active = true;
        this.createTime = LocalDateTime.now();
    }

    public String getUsername() { return username; }
    public void setUsername(String username) { this.username = username; }

    public String getPassword() { return password; }
    public void setPassword(String password) { this.password = password; }

    public String getRole() { return role; }
    public void setRole(String role) { this.role = role; }

    public String getRealName() { return realName; }
    public void setRealName(String realName) { this.realName = realName; }

    public String getPhone() { return phone; }
    public void setPhone(String phone) { this.phone = phone; }

    public String getEmail() { return email; }
    public void setEmail(String email) { this.email = email; }

    public LocalDateTime getCreateTime() { return createTime; }
    public void setCreateTime(LocalDateTime createTime) { this.createTime = createTime; }

    public boolean isActive() { return active; }
    public void setActive(boolean active) { this.active = active; }

    @Override
    public String toString() {
        return String.format("用户[账号:%s, 姓名:%s, 角色:%s, 状态:%s]",
                username, realName, role, active ? "激活" : "禁用");
    }
}